﻿Public Class BlockFiveHomeworkSectionFive
    Dim QuestionNumber As Integer
    Dim dtmTest, dtmTest2 As Date
    Dim filename As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    'Declare the Array as 10 rows and 3 columns
    Dim ArrayMax As Integer = 34 'One number past the end of actual info in array
    Dim HWQuestions(ArrayMax, 7) As String
    Dim intResponse As Integer
    Dim intQuestionCount As Integer = 0
    Dim intAnswerCount As Integer = 0
    Dim intReferenceCount As Integer = 0
    Dim intFirstRun As Integer = 1
    Dim strUser As String = "Enter Last Name"
    Dim strAnswer, strAnswer2, strAnswer3, strAnswer4, strAnswer5, _
     strAnswer6, strAnswer7, strAnswer8, strAnswer9, strAnswer10, strAnswer11, _
     strAnswer12, strAnswer13, strAnswer14, strAnswer15, strAnswer16, _
     strAnswer17, strAnswer18, strAnswer19, strAnswer20, strAnswer21, _
     strAnswer22, strAnswer23, strAnswer24, strAnswer25, strAnswer26, _
     strAnswer27, strAnswer28, strAnswer29, strAnswer30, strAnswer31 As String
    Dim intChoiceACount As Integer = 2
    Dim intChoiceBCount As Integer = 3
    Dim intChoiceCCount As Integer = 4
    Dim intChoiceDCount As Integer = 5

    Shared Property MidiParent As MainForm

    Private Sub CloseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub BlockTwoHomeworkSectionOne_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        txtObj.Text = "Objectives:" + vbCrLf + "- Given proper student instructional materials, describe the central equipment rack circuit card assemblies."
        If (System.IO.File.Exists(filename & "\Homework\Block 5\Block 5 Section 5.txt")) Then
            intResponse = MsgBox("This assignment has already been completed.  Are you sure you want to delete the current assignment and reaccomplish it?", 4, "Confirm Assignment Deletion")
            If intResponse = MsgBoxResult.Yes Then
                System.IO.File.Delete(filename & "\Homework\Block 5\Block 5 Section 5.txt")
                System.IO.File.Create(filename & "\Homework\Block 5\Block 5 Section 5.txt").Dispose()
            ElseIf intResponse = MsgBoxResult.No Then
                Me.Close()
            End If
        End If
        If (Not System.IO.File.Exists(filename & "\Homework\Block 5\Block 5 Section 5.txt")) Then
            System.IO.File.Create(filename & "\Homework\Block 5\Block 5 Section 5.txt").Dispose()
        End If
        If (Not System.IO.File.Exists(filename & "\Instructor\Block 5\Block 5 Section 5.txt")) Then
            System.IO.File.Create(filename & "\Instructor\Block 5\Block 5 Section 5.txt").Dispose()
        End If
        strUser = InputBox("Please enter last name", strUser)
        If strUser Is "" Then
            Me.Close()
        End If
        '************************************************
        '****** Questions Are Loaded Here****************
        '******* Column 1 is Questions (Preloaded)*******
        '******* Column 2 is Accepts Students Answer*****
        '******* Column 3 is Reference ******************

        HWQuestions(1, 1) = "1. When replacing cards, make sure the correct firmware EPROM(s) is installed for the function the card is to perform. "
        HWQuestions(1, 2) = "True"
        HWQuestions(1, 4) = "False"
        HWQuestions(1, 5) = ""
        HWQuestions(1, 6) = ""
        HWQuestions(1, 3) = "Reference"

        HWQuestions(2, 1) = "2. The status of each micro-processor is monitored by a ___________________. "
        HWQuestions(2, 2) = "watchdog timer"
        HWQuestions(2, 4) = "micro-monitor"
        HWQuestions(2, 5) = "synchronizer"
        HWQuestions(2, 6) = "built in test"
        HWQuestions(2, 3) = "Reference"

        HWQuestions(3, 1) = "3. Each processor card in the ETVS contains _______________. "
        HWQuestions(3, 2) = "RAM"
        HWQuestions(3, 4) = "EPROM"
        HWQuestions(3, 5) = "EEPROM"
        HWQuestions(3, 6) = "All the Above"
        HWQuestions(3, 3) = "Reference"

        HWQuestions(4, 1) = "4. TMUs are installed in __________ to provide redundancy for system timing and muxing circuitry. "
        HWQuestions(4, 2) = "Clusters"
        HWQuestions(4, 4) = "Parallel"
        HWQuestions(4, 5) = "Series"
        HWQuestions(4, 6) = "Pairs"
        HWQuestions(4, 3) = "Reference"

        HWQuestions(5, 1) = "5. A basic clock signal of __________ MHz and a system frame pulse are used throughout the system to facilitate voice data multiplexing."
        HWQuestions(5, 2) = "12"
        HWQuestions(5, 4) = "16"
        HWQuestions(5, 5) = "2048"
        HWQuestions(5, 6) = "4096"
        HWQuestions(5, 3) = "Reference"

        HWQuestions(6, 1) = "6. __________ data from each cluster is fed to each MUX unit as a 2.048 MHz CEPT serial data stream."
        HWQuestions(6, 2) = "Voice"
        HWQuestions(6, 4) = "Silence"
        HWQuestions(6, 5) = "Receive"
        HWQuestions(6, 6) = "Transmit"
        HWQuestions(6, 3) = "Reference"

        HWQuestions(7, 1) = "7. Each conferencer can serve up to _________ phone lines. "
        HWQuestions(7, 2) = "2"
        HWQuestions(7, 4) = "30"
        HWQuestions(7, 5) = "186"
        HWQuestions(7, 6) = "480"
        HWQuestions(7, 3) = "Reference"

        HWQuestions(8, 1) = "8. To ensure redundancy in the cluster-level muxing process, _________ phone conferencers process each group of telephone channels."
        HWQuestions(8, 2) = "2"
        HWQuestions(8, 4) = "30"
        HWQuestions(8, 5) = "186"
        HWQuestions(8, 6) = "480"
        HWQuestions(8, 3) = "Reference"

        HWQuestions(9, 1) = "9. A _________ manages the distribution of voice data to and from the telephone interfaces."
        HWQuestions(9, 2) = "ST"
        HWQuestions(9, 4) = "CPS"
        HWQuestions(9, 5) = "DSP"
        HWQuestions(9, 6) = "C186"
        HWQuestions(9, 3) = "Reference"

        HWQuestions(10, 1) = "10. Each telephone interface card furnishes all necessary call progress signaling for the line it interfaces."
        HWQuestions(10, 2) = "True"
        HWQuestions(10, 4) = "False"
        HWQuestions(10, 5) = ""
        HWQuestions(10, 6) = ""
        HWQuestions(10, 3) = "Reference"

        HWQuestions(11, 1) = "11. To set up a card for a particular service, the device-type selector switch, ______, and a series of circuit card jumpers must be set."
        HWQuestions(11, 2) = strAnswer11
        HWQuestions(11, 3) = "Reference"

        HWQuestions(12, 1) = "12. A change of telephone line status must pass over the Dual ST bus to the Phone Conferencer, then over the ____________________ to an Operator Processor."
        HWQuestions(12, 2) = "Cluster Bus"
        HWQuestions(12, 4) = "Voice Data Bus"
        HWQuestions(12, 5) = "PCM HWY Bus"
        HWQuestions(12, 6) = "Control Data Bus"
        HWQuestions(12, 3) = "Reference"

        HWQuestions(13, 1) = "13. What data is contained in the CNTRL 1 & CNTRL 2 ST streams for a PBX Interface?"
        HWQuestions(13, 2) = "DTMF generation"
        HWQuestions(13, 4) = "Ring enable"
        HWQuestions(13, 5) = "Dial pulse"
        HWQuestions(13, 6) = "All of the above"
        HWQuestions(13, 3) = "Reference"

        HWQuestions(14, 1) = "14. When the operator selects the associated line, the PBX interface creates a (an) __________ condition."
        HWQuestions(14, 2) = "hook-flash"
        HWQuestions(14, 4) = "hook-line"
        HWQuestions(14, 5) = "off-hook"
        HWQuestions(14, 6) = "idle"
        HWQuestions(14, 3) = "Reference"

        HWQuestions(15, 1) = "15. _______________ on the device-type selector, S1, places the interface in the align mode."
        HWQuestions(15, 2) = "Position 0"
        HWQuestions(15, 4) = "Position 1"
        HWQuestions(15, 5) = "Position F"
        HWQuestions(15, 6) = "Position 7-E"
        HWQuestions(15, 3) = "Reference"

        HWQuestions(16, 1) = "16. The ASU interface is always a ____ -Wire card."
        HWQuestions(16, 2) = strAnswer16
        HWQuestions(16, 3) = "Reference"

        HWQuestions(17, 1) = "17. What is the function of the VOX detect circuit on the ASU interface?"
        HWQuestions(17, 2) = "Respond to line select commands from the position."
        HWQuestions(17, 4) = "Detects incoming DTMF for dial in circuits."
        HWQuestions(17, 5) = "Listen for the watchdog timer"
        HWQuestions(17, 6) = "Listen for incoming voice"
        HWQuestions(17, 3) = "Reference"

        HWQuestions(18, 1) = "18. If an ASU is configured for the auto ring mode, the 20-Hz signal will be placed on line when the operator _________ the circuit."
        HWQuestions(18, 2) = "selects"
        HWQuestions(18, 4) = "bridges"
        HWQuestions(18, 5) = "calibrates"
        HWQuestions(18, 6) = "spares out"
        HWQuestions(18, 3) = "Reference"

        HWQuestions(19, 1) = "19. The E&M interface is a __________ -Wire card."
        HWQuestions(19, 2) = "4"
        HWQuestions(19, 4) = "6"
        HWQuestions(19, 5) = "8"
        HWQuestions(19, 6) = "All of the above"
        HWQuestions(19, 3) = "Reference"

        HWQuestions(20, 1) = "20. When tone-on-idle detection is in use, the presence of a 2400 Hz or 2600 Hz single frequency tone alerts the distant end that an incoming call is present.?"
        HWQuestions(20, 2) = "True"
        HWQuestions(20, 4) = "False"
        HWQuestions(20, 5) = ""
        HWQuestions(20, 6) = ""
        HWQuestions(20, 3) = "Reference"

        HWQuestions(21, 1) = "21. In a back to back configuration, the E-lead connects to the __________ port at the distant end."
        HWQuestions(21, 2) = strAnswer16
        HWQuestions(21, 3) = "Reference"

        HWQuestions(22, 1) = "22. What data is contained in the CNTRL 1 ST stream for a SS–1/4 Interface?"
        HWQuestions(22, 2) = "SS-1 tone enable"
        HWQuestions(22, 4) = "SS-1 tone select"
        HWQuestions(22, 5) = "Align Mode"
        HWQuestions(22, 6) = "All of the Above"
        HWQuestions(22, 3) = "Reference"

        HWQuestions(23, 1) = "23. What data is contained in the STAT 1 & STAT 2 ST streams for an SS–1/4 interface?"
        HWQuestions(23, 2) = "Power-down"
        HWQuestions(23, 4) = "VOX detect"
        HWQuestions(23, 5) = "Align Mode"
        HWQuestions(23, 6) = "None of the above"
        HWQuestions(23, 3) = "Reference"

        HWQuestions(24, 1) = "24. What is the function of the FSK Tone Generation and Detection circuits?"
        HWQuestions(24, 2) = "Generates test tones used to monitor the status of all telephone interface boards."
        HWQuestions(24, 4) = "Generates test tones used to monitor the status of the SS–1 and SS–2 telephone interface boards."
        HWQuestions(24, 5) = "Generates outgoing signaling tones and detects the presence of incoming signaling for dial-in and dial-out modes of operation."
        HWQuestions(24, 6) = "All of the Above"
        HWQuestions(24, 3) = "Reference"

        HWQuestions(25, 1) = "25. Each processor serves both transmit and receive requirements of __________ system radio channel."
        HWQuestions(25, 2) = "1"
        HWQuestions(25, 4) = "2"
        HWQuestions(25, 5) = "3"
        HWQuestions(25, 6) = "5"
        HWQuestions(25, 3) = "Reference"

        HWQuestions(26, 1) = "26. Set 'S1' to position _____ to access main only transmitters and receivers."
        HWQuestions(26, 2) = "0"
        HWQuestions(26, 4) = "1"
        HWQuestions(26, 5) = "2"
        HWQuestions(26, 6) = "F"
        HWQuestions(26, 3) = "Reference"

        HWQuestions(27, 1) = "27. The VOX indicator lights green for receive voice at __________ and extinguishes at __________."
        HWQuestions(27, 2) = "-28 dBm/-34 dBm"
        HWQuestions(27, 4) = "-28 dBm0/-34 dBm0"
        HWQuestions(27, 5) = "-22 dBm/-28 dBm."
        HWQuestions(27, 6) = "-22 dBm0/-28 dBm0"
        HWQuestions(27, 3) = "Reference"

        HWQuestions(28, 1) = "28. The Enhanced Operator Processor interfaces the operator position with the _____________ equipment."
        HWQuestions(28, 2) = "central rack"
        HWQuestions(28, 4) = "radio channel"
        HWQuestions(28, 5) = "telephone company"
        HWQuestions(28, 6) = "operators headset/speaker"
        HWQuestions(28, 3) = "Reference"


        HWQuestions(29, 1) = "29. The DIGN LED is flashing yellow on the Operator Processor. What does this indicate?"
        HWQuestions(29, 2) = "A time slot error"
        HWQuestions(29, 4) = "A frame pulse error"
        HWQuestions(29, 5) = "Primary ISDN link is down"
        HWQuestions(29, 6) = "Receive audio is unintelligible"
        HWQuestions(29, 3) = "Reference"

        HWQuestions(30, 1) = "30. The Control and status data is extracted by the on-board microprocessor and routed to the appropriate destination over the _______________ bus."
        HWQuestions(30, 2) = "A/B Control Data"
        HWQuestions(30, 4) = "Voice Data"
        HWQuestions(30, 5) = "Dual ST"
        HWQuestions(30, 6) = "Cluster"
        HWQuestions(30, 3) = "Reference"

        HWQuestions(31, 1) = "31. The supervisory record interface allows the supervisor to record audio from __________ positions simultaneously."
        HWQuestions(31, 2) = "all"
        HWQuestions(31, 4) = "two"
        HWQuestions(31, 5) = "split"
        HWQuestions(31, 6) = "remote"
        HWQuestions(31, 3) = "Reference"

        HWQuestions(32, 1) = "32. The receive path on the Supervisory Record Card is _______________."
        HWQuestions(32, 2) = "unused"
        HWQuestions(32, 4) = "unwanted"
        HWQuestions(32, 5) = "offloaded"
        HWQuestions(32, 6) = "unavailable"
        HWQuestions(32, 3) = "Reference"

        HWQuestions(33, 1) = "Close"

        Next_Question(HWQuestions)
    End Sub

    Private Sub btnNextQuestion_Click(sender As System.Object, e As System.EventArgs) Handles btnNextQuestion.Click
        Next_Question(HWQuestions)
    End Sub
    Private Sub Clear_Display()
        txtQuestion.Clear()
        txtAnswer.Clear()
    End Sub

    Public Function Next_Question(HWQuestions As String(,))
        txtAnswer.Focus()
        If intQuestionCount > 0 Then
            WriteToFile()
        End If
        If btnNextQuestion.Text = "Done" Then
            Me.Close()
            OpenResults()
        End If
        intQuestionCount = intQuestionCount + 1
        If intQuestionCount = 32 Then
            btnNextQuestion.Text = "Done"
        End If
        If intQuestionCount <= 10 Or intQuestionCount = 12 Or intQuestionCount = 13 Or intQuestionCount = 14 _
            Or intQuestionCount = 15 Or intQuestionCount = 17 Or intQuestionCount = 18 Or intQuestionCount = 19 _
            Or intQuestionCount = 20 Or intQuestionCount >= 22 Then
            txtAnswer.Visible = False
            lblAnswer.Visible = False
            txtChoiceA.Visible = True
            txtChoiceB.Visible = True
            txtChoiceC.Visible = True
            txtChoiceD.Visible = True
            lblChoiceA.Visible = True
            lblChoiceB.Visible = True
            lblChoiceC.Visible = True
            lblChoiceD.Visible = True
            chkboxChoiceA.Visible = True
            chkboxChoiceB.Visible = True
            chkboxChoiceC.Visible = True
            chkboxChoiceD.Visible = True

            txtQuestion.Text = HWQuestions(intQuestionCount, 1)
            txtChoiceA.Text = HWQuestions(intQuestionCount, 2)
            txtChoiceB.Text = HWQuestions(intQuestionCount, 4)
            txtChoiceC.Text = HWQuestions(intQuestionCount, 5)
            txtChoiceD.Text = HWQuestions(intQuestionCount, 6)

        ElseIf intQuestionCount = 11 Or intQuestionCount = 16 Or intQuestionCount = 21 Then
            txtAnswer.Visible = True
            lblAnswer.Visible = True
            txtChoiceA.Visible = False
            txtChoiceB.Visible = False
            txtChoiceC.Visible = False
            txtChoiceD.Visible = False
            lblChoiceA.Visible = False
            lblChoiceB.Visible = False
            lblChoiceC.Visible = False
            lblChoiceD.Visible = False
            chkboxChoiceA.Visible = False
            chkboxChoiceB.Visible = False
            chkboxChoiceC.Visible = False
            chkboxChoiceD.Visible = False
            txtQuestion.Text = HWQuestions(intQuestionCount, 1)
            intAnswerCount = intAnswerCount + 1
            HWQuestions(intAnswerCount, 2) = txtAnswer.Text
            intReferenceCount = intReferenceCount + 1
            txtReference.Text = HWQuestions(intReferenceCount, 3)
        End If
        Return intQuestionCount & intAnswerCount
    End Function
    Private Sub WriteToFile()
        Dim Integrity As String = (filename & "\Instructor\Block 5\Block 5 Section 5.txt")
        Dim Results As String = (filename & "\Homework\Block 5\Block 5 Section 5.txt")

        '***********Output to hidden file for Instructor Check***********
        If System.IO.File.Exists(Integrity) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Integrity, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            If intQuestionCount <= 10 Or intQuestionCount = 12 Or intQuestionCount = 13 Or intQuestionCount = 14 _
    Or intQuestionCount = 15 Or intQuestionCount = 17 Or intQuestionCount = 18 Or intQuestionCount = 19 _
    Or intQuestionCount = 20 Or intQuestionCount >= 22 Then
                If chkboxChoiceA.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  A: " & txtChoiceA.Text)
                ElseIf chkboxChoiceB.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  B: " & txtChoiceB.Text)
                ElseIf chkboxChoiceC.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  C: " & txtChoiceC.Text)
                ElseIf chkboxChoiceD.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  D: " & txtChoiceD.Text)
                End If
                hiddenWriter.WriteLine()
            End If
            If chkboxChoiceA.Visible = False Then
                hiddenWriter.WriteLine("Answer:" & txtAnswer.Text)
                hiddenWriter.WriteLine()
            End If
            If intQuestionCount = 32 Then
                hiddenWriter.WriteLine("Block 5 Section 5 Homework Complete")
                hiddenWriter.WriteLine("Date: " & (DateValue(Now)))
                hiddenWriter.WriteLine("Time: " & (TimeValue(Now)))
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Integrity")
        End If

        '******Output to file for Student to review***********
        If System.IO.File.Exists(Results) = True Then
            Dim hiddenWriter As New System.IO.StreamWriter(Results, True)
            If intQuestionCount = 1 Then
                hiddenWriter.WriteLine("- " & txtObj.Text)
                hiddenWriter.WriteLine()
                hiddenWriter.WriteLine("Student: " & strUser)
                hiddenWriter.WriteLine()
            End If
            hiddenWriter.WriteLine("Question:" & txtQuestion.Text)
            If intQuestionCount <= 10 Or intQuestionCount = 12 Or intQuestionCount = 13 Or intQuestionCount = 14 _
    Or intQuestionCount = 15 Or intQuestionCount = 17 Or intQuestionCount = 18 Or intQuestionCount = 19 _
    Or intQuestionCount = 20 Or intQuestionCount >= 22 Then
                If chkboxChoiceA.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  A: " & txtChoiceA.Text)
                ElseIf chkboxChoiceB.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  B: " & txtChoiceB.Text)
                ElseIf chkboxChoiceC.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  C: " & txtChoiceC.Text)
                ElseIf chkboxChoiceD.CheckState = 1 Then
                    hiddenWriter.WriteLine("Answer:  D: " & txtChoiceD.Text)
                End If
                hiddenWriter.WriteLine()
            End If
            If chkboxChoiceA.Visible = False Then
                hiddenWriter.WriteLine("Answer:" & txtAnswer.Text)
                hiddenWriter.WriteLine()
            End If
            If intQuestionCount = 32 Then
                hiddenWriter.WriteLine("Block 5 Section 5 Homework Complete")
            End If
            hiddenWriter.Close()

            'MsgBox("Text written to file")
        Else
            MsgBox("File Does Not Exist Integrity")
        End If

        If intQuestionCount > 0 Then
            txtAnswer.Clear()
            chkboxChoiceA.CheckState = CheckState.Unchecked
            chkboxChoiceB.CheckState = CheckState.Unchecked
            chkboxChoiceC.CheckState = CheckState.Unchecked
            chkboxChoiceD.CheckState = CheckState.Unchecked
        End If

    End Sub

    Private Sub OpenResults()
        Dim p As Process = Process.Start(filename & "\Homework\Block 5\Block 5 Section 5.txt")
    End Sub
End Class
